<template>
	<div>
		<Header :city="city" />
		<Swiper :list="swiperList" />
		<Icons />
		<Recommend :list="recommendList" />
		<Weekend :list="weekendList" />
	</div>
</template>

<script>
	import Header from "./components/header";
	import Swiper from "./components/swiper";
	import Icons from "./components/icons";
	import Recommend from "./components/recommend";
	import Weekend from "./components/weekend";
	import axios from 'axios'
	export default {
		name: "home",
		components: {
			Header,
			Swiper,
			Icons,
			Recommend,
			Weekend
		},
		data() {
			return {
				city: '',
				swiperList: [],
				recommendList: [],
				weekendList: []
			}
		},
		mounted() {
			this.getData()
		},
		methods: {
			getData() {
				axios.get('/api/index.json').then(this.getList)
			},
			getList(res) {
				const data = res.data.data;
				if(res.data.ret && data) {
					this.city = '北京';
					this.swiperList = data.swiperList;
					this.recommendList = data.recommendList;
					this.weekendList = data.weekendList;
					console.log(data)
				}
				console.log(res)
			}
		}
	};
</script>

<style scoped></style>
